<?php 
	$objACL		= new HT_Model_administrator_models_acl();
	$objMenu	= new HT_Model_administrator_models_menu();
	@$auth 		= Zend_Auth::getInstance();
	$user 		= @$auth->getStorage()->read();
	$groupMenu	= $objMenu->getLeftMenu();
?>
<!-- 
<nav id='main-nav' class=''> <!--  sidebar --
-->
<nav id='main-nav' class='main-nav-fixed affix left_phucsidebar'>
 
        <div class='navigation'>
          <ul class='nav nav-stacked navscroll2'>
          <li>
              <a href="#" style="height: 0px;" ></a>
          </li>
            <li class=''>
        
              <a href='<?php echo WEB_PATH;?>/administrator'>
                <i class='icon-dashboard'></i>
                <span><?php echo ucfirst($user->role_name);?> dashboard</span>
              </a>
            </li>
            
            
            
            
            
            
            
             <li class=''>
                      <a class="dropdown-collapse" href="#"><i class='icon-edit'></i>
              <span>Forms</span>
              <i class='icon-angle-down angle-down'></i>
              </a>
            
              <ul class='nav nav-stacked'>
                <li class=''>
                
                  <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/formstyles';?>'>
                    <i class='icon-caret-right'></i>
                    <span>Form styles and features</span>
                  </a>
                </li>
                <li class=''>
                 <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/formcomponents';?>'>
                    <i class='icon-caret-right'></i>
                    <span>Form components</span>
                  </a>
                </li>
                <li class=''>
                <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/validations';?>'>
                  <i class='icon-caret-right'></i>
                    <span>Validations</span>
                  </a>
                </li>
                <li class=''>
                   <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/wizard';?>'>
                    <i class='icon-caret-right'></i>
                    <span>Wizard</span>
                  </a>
                </li>
              </ul>
            </li>
            <li>
              <a class='dropdown-collapse ' href='#'>
                <i class='icon-tint'></i>
                <span >UI Elements & Widgets</span>
                <i class='icon-angle-down angle-down'></i>
              </a>
              <ul class='nav nav-stacked'>
                <li class=''>
                 <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/uielements';?>'>
                   <i class='icon-caret-right'></i>
                    <span>UI Elements</span>
                  </a>
                </li>
                <li class=''>
              <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/widgets';?>'>
                 <i class='icon-caret-right'></i>
                    <span>Widgets</span>
                  </a>
                </li>
              </ul>
            </li>
            <li class=''>
             <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/buttonsandicons';?>'>
              <i class='icon-star'></i>
                <span>Buttons & Icons</span>
              </a>
            </li>
            <li>
              <a class='dropdown-collapse ' href='#'>
                <i class='icon-cogs'></i>
                <span>Component</span>
                <i class='icon-angle-down angle-down'></i>
              </a>
              <ul class='nav nav-stacked'>
                <li class=''>
                  <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/charts';?>'>
                    <i class='icon-bar-chart'></i>
                    <span>Charts</span>
                  </a>
                </li>
                <li class=''>
                <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/addressbook';?>'>
                  <i class='icon-envelope'></i>
                    <span>Address book</span>
                  </a>
                </li>
                <li class=''>
                 <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/chats';?>'>
                 <i class='icon-comments'></i>
                    <span>Chats</span>
                  </a>
                </li>
                <li class=''>
                 <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/filetrees';?>'>
                  <i class='icon-list-ul'></i>
                    <span>File trees</span>
                  </a>
                </li>
                <li class=''>
                 <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/fileupload';?>'>
                  <i class='icon-file'></i>
                    <span>Fileupload</span>
                  </a>
                </li>
                <li class=''>
                   <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/todo';?>'>
                   <i class='icon-list-alt'></i>
                    <span>Todo list</span>
                  </a>
                </li>
                <li class=''>
               <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/wysiwyg';?>'>
               <i class='icon-paste'></i>
                    <span>WYSIWYG</span>
                  </a>
                </li>
              </ul>
            </li>
            <li class=''>
              <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/tables';?>'>
               <i class='icon-table'></i>
                <span>Tables</span>
              </a>
            </li>
            <li class=''>
             <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/grid';?>'>
                <i class='icon-th'></i>
                <span>Grid</span>
              </a>
            </li>
            
             <li class=''>
             <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/type';?>'>
                <i class='icon-font'></i>
                <span>Typography</span>
              </a>
            </li>
            <li class=''>
               <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/calendar';?>'>   
                <i class='icon-calendar'></i>
                <span>Calendar</span>
              </a>
            </li>
            <li>
              <a class='dropdown-collapse ' href='#'>
                <i class='icon-book'></i>
                <span>ExPages</span>
                <i class='icon-angle-down angle-down'></i>
              </a>
              <ul class='nav nav-stacked'>
                <li class=''>
                <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/invoice';?>'>   
                  <i class='icon-money'></i>
                    <span>Invoice</span>
                  </a>
                </li>
                <li class=''>
                 <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/gallery';?>'>   
                  <i class='icon-picture'></i>
                    <span>Gallery</span>
                  </a>
                </li>
                <li class=''>
                  <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/timeline';?>'>   
                    <i class='icon-time'></i>
                    <span>Timeline</span>
                  </a>
                </li>
                <li class=''>
                   <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/pricingtables';?>'>  
                    <i class='icon-table'></i>
                    <span>Pricing tables</span>
                  </a>
                </li>
                <li class=''>
                   <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/userprofile';?>'>  
                    <i class='icon-user'></i>
                    <span>User profile</span>
                  </a>
                </li>
                <!--  -->
                <li class='' id=''>
                 <a  class="error404" href='<?php echo WEB_PATH.'/administrator/Libdragdrop/err404';?>'>  
                    <i class='icon-question-sign'></i>
                    <span>404 Error</span>
                  </a>
                </li>
                <li class=''>
                  <a href='err500.html' ><!-- target='_blank' -->
                    <i class='icon-cogs'></i>
                    <span>500 Error</span>
                  </a>
                </li>
                <li class=''>
                  <a href='sign_in.html'><!-- target='_blank' -->
                    <i class='icon-signin'></i>
                    <span>Sign in</span>
                  </a>
                </li>
                <li class=''>
                  <a href='faq.html'>
                    <i class='icon-bullhorn'></i>
                    <span>FAQ</span>
                  </a>
                </li>
                <li class=''>
                  <a href='orders.html'>
                    <i class='icon-inbox'></i>
                    <span>Orders</span>
                  </a>
                </li>
                <li class=''>
                  <a href='search_results.html'>
                    <i class='icon-search'></i>
                    <span>Search results</span>
                  </a>
                </li>
                <li class=''>
                 <a href='<?php echo WEB_PATH.'/administrator/Libdragdrop/blank';?>'>   
                    <i class='icon-circle-blank'></i>
                    <span>Blank page</span>
                  </a>
                </li>
              </ul>
            </li>
            <li>
              <a class='dropdown-collapse ' href='#'>
                <i class='icon-cog'></i>
                <span>Layouts</span>
                <i class='icon-angle-down angle-down'></i>
              </a>
              <ul class='nav nav-stacked'>
                <li class=''>
                  <a href='closed_navigation.html'>
                    <i class='icon-caret-right'></i>
                    <span>Closed navigation</span>
                  </a>
                </li>
                <li class=''>
                  <a href='fixed_header.html'>
                    <i class='icon-caret-right'></i>
                    <span>Fixed header</span>
                  </a>
                </li>
                <li class=''>
                  <a href='fixed_navigation.html'>
                    <i class='icon-caret-right'></i>
                    <span>Fixed navigation</span>
                  </a>
                </li>
                <li class=''>
                  <a href='fixed_navigation_and_header.html'>
                    <i class='icon-caret-right'></i>
                    <span>Fixed navigation & header</span>
                  </a>
                </li>
              </ul>
            </li>
            <li class=''>
              <a href='email_templates.html'>
                <i class='icon-mail-reply'></i>
                <span>Email templates</span>
              </a>
            </li>
            <li>
              <a class='dropdown-collapse' href='#'>
                <i class='icon-folder-open-alt'></i>
                <span>Four level dropdown</span>
                <i class='icon-angle-down angle-down'></i>
              </a>
              <ul class='nav nav-stacked'>
                <li>
                  <a class='dropdown-collapse' href='#'>
                    <i class='icon-caret-right'></i>
                    <span>Second level</span>
                    <i class='icon-angle-down angle-down'></i>
                  </a>
                  <ul class='nav nav-stacked'>
                    <li>
                      <a class='dropdown-collapse' href='#'>
                        <i class='icon-caret-right'></i>
                        <span>Third level</span>
                        <i class='icon-angle-down angle-down'></i>
                      </a>
                      <ul class='nav nav-stacked'>
                        <li>
                          <a href='#'>
                            <i class='icon-caret-right'></i>
                            <span>Fourth level</span>
                          </a>
                        </li>
                        <li>
                          <a href='#'>
                            <i class='icon-caret-right'></i>
                            <span>Another fourth level</span>
                          </a>
                        </li>
                      </ul>
                    </li>
                  </ul>
                </li>
              </ul>
            </li>
            
         </ul>
            
            
            
            
            
          <ul class='nav nav-stacked '>   
            <?php 
	            if(isset($user->role_id) && (int)$user->role_id >0){
	            	$roldId = (int)$user->role_id;
	            	//$roldId = 13;
	            	$actionRight = $objACL->getActionRight($roldId);
	            	$groupMenu	 = $objMenu->buildLeftMenu($groupMenu,$actionRight);
	            	//echo "<pre>";
	            	//print_r($moduleRight);
	            	foreach((array)$groupMenu as $group){
	            		$groupId 		= $group['group_id'];
	            		$groupName 		= $group['group_name'];
	            		$groupURL 		= $group['group_url'];
	            		$menuList 		= $group['menu_list'];
	            		$groupIcon 		= trim($group['group_icon']);
	            		$hasSub			= $group['has_sub'];
	            		if(!$groupIcon) $groupIcon = 'icon-edit';
           		if($hasSub){ 
	       ?>
            
            <li class=''>
              <a class="dropdown-collapse" id="role_user" href="#">
	              <i class='<?php echo $groupIcon;?>'></i>
	              <span><?php echo $groupName;?></span>
	              <i class='icon-angle-down angle-down'></i>
              </a>
              <ul class='nav nav-stacked'>
              <?php 
		  	   		foreach($menuList as $menu){
						$menuName = $menu['menu_name'];
						$menuUrl = $menu['menu_url'];
						$actionId = $menu['action_id'];
						list($info,$menuUrl) = explode('administrator/', $menuUrl);
						$menuUrl 			 = WEB_PATH.'/administrator/'.$menuUrl;
						if(in_array($actionId,$actionRight)){
		  	   				echo "<li class=''>";
		  	   					echo "<a href='".$menuUrl."'>";
		  	   						echo "<i class='icon-caret-right'></i>";
		  	   						echo "<span>".$menuName."</span>";
		  	   					echo "</a>";
		  	   				echo "</li>";
		  	   			}
		  	   		}
		  	   ?>  	
              </ul>
            </li>
            <?php }else{
            	if(strpos($groupURL, 'administrator')=== FALSE){
            		continue;
            	}else{
            		$arr = explode('administrator', $groupURL);
            		$groupURL = WEB_PATH.'/administrator'.$arr[1];
            	}
            ?>
            <li class=''>
              <a  href="<?php echo $groupURL;?>">
	              <i class='<?php echo $groupIcon;?>'></i>
	              <span><?php echo $groupName;?></span>
              </a>
            </li>
            <?php 
            }}}?>
          </ul>
        </div>
      </nav>